package com.ruoyi.web.controller.edh;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.edh.domain.dto.EdhTeamOrderStatisticsDto;
import com.ruoyi.edh.domain.vo.EdhTeamOrderVo;
import com.ruoyi.edh.service.IEdhTeamOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/edh/team/orders")
@Api(description = "易订货-团长订单")
public class EdhTeamOrderController extends BaseController {
    @Autowired
    private IEdhTeamOrderService edhTeamOrderService;

    /**
     * 查询易订货-数据统计供应商列表
     */
    @GetMapping("/teamOrderList")
    @ApiOperation("易订货-团长订单列表")
    public TableDataInfo selectTeamOrderList(EdhTeamOrderStatisticsDto edhTeamOrderStatisticsDto) {
        startPage();
        List<EdhTeamOrderVo> list = edhTeamOrderService.selectTeamOrderList(edhTeamOrderStatisticsDto);
        return getDataTable(list);
    }

    /**
     * 导出易订货-数据统计供应商列表
     */
    @Log(title = "易订货-团长订单列表", businessType = BusinessType.EXPORT)
    @GetMapping("/teamOrderExport")
    @ApiOperation("导出易订货-团长订单列表")
    public AjaxResult teamOrderExport(EdhTeamOrderStatisticsDto edhTeamOrderStatisticsDto) {
        List<EdhTeamOrderVo> list = edhTeamOrderService.selectTeamOrderList(edhTeamOrderStatisticsDto);
        ExcelUtil<EdhTeamOrderVo> util = new ExcelUtil<EdhTeamOrderVo>(EdhTeamOrderVo.class);
        return util.exportExcel(list, "teamOrder");
    }
}
